import { S } from '../../s';
import { IPSAppCodeList } from '../../app/codelist/ipsapp-code-list';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { PSMDAjaxControlContainerImpl2 } from '../psmdajax-control-container-impl2';
import { IPSDEList } from './ipsdelist';
import { IPSDEListDataItem } from './ipsdelist-data-item';
import { IPSDEListItem } from './ipsdelist-item';
import { IPSLayoutPanel } from '../panel/ipslayout-panel';
import { IPSLanguageRes } from '../../res/ipslanguage-res';

export class PSDEListImpl
  extends PSMDAjaxControlContainerImpl2
  implements IPSDEList
{
  get codeName(): string {
    return this.M.codeName;
  }

  get emptyText(): string {
    return this.M.emptyText;
  }

  protected emptytextpslanguageres: IPSLanguageRes;
  getEmptyTextPSLanguageRes(): IPSLanguageRes | null {
    return (
      this.emptytextpslanguageres ||
      (this.emptytextpslanguageres = this.fillObjectModel(
        S._276,
        this.M.getEmptyTextPSLanguageRes,
        S._2b4,
      ) as IPSLanguageRes)
    );
  }

  get groupMode(): 'NONE' | 'AUTO' | 'CODELIST' {
    return this.M.groupMode;
  }

  protected grouppsappdefield: IPSAppDEField;
  getGroupPSAppDEField(): IPSAppDEField | null {
    return (
      this.grouppsappdefield ||
      (this.grouppsappdefield = this.fillObjectModel(
        S._1,
        this.M.getGroupPSAppDEField,
        S._34c,
      ) as IPSAppDEField)
    );
  }

  protected grouppscodelist: IPSAppCodeList;
  getGroupPSCodeList(): IPSAppCodeList | null {
    return (
      this.grouppscodelist ||
      (this.grouppscodelist = this.fillObjectModel(
        S._8,
        this.M.getGroupPSCodeList,
        S._34d,
      ) as IPSAppCodeList)
    );
  }

  protected itempslayoutpanel: IPSLayoutPanel;
  getItemPSLayoutPanel(): IPSLayoutPanel | null {
    return (
      this.itempslayoutpanel ||
      (this.itempslayoutpanel = this.fillObjectModel(
        S._255,
        this.M.getItemPSLayoutPanel,
        S._351,
      ) as IPSLayoutPanel)
    );
  }

  get minorSortDir(): 'ASC' | 'DESC' {
    return this.M.minorSortDir;
  }

  protected minorsortpsappdefield: IPSAppDEField;
  getMinorSortPSAppDEField(): IPSAppDEField | null {
    return (
      this.minorsortpsappdefield ||
      (this.minorsortpsappdefield = this.fillObjectModel(
        S._1,
        this.M.getMinorSortPSAppDEField,
        S._2b9,
      ) as IPSAppDEField)
    );
  }

  get mobListStyle():
    | 'ICONVIEW'
    | 'LISTVIEW'
    | 'SWIPERVIEW'
    | 'LISTVIEW2'
    | 'LISTVIEW3'
    | 'LISTVIEW4'
    | 'EXTVIEW1'
    | 'EXTVIEW2'
    | 'EXTVIEW3'
    | 'EXTVIEW4'
    | 'EXTVIEW5' {
    return this.M.mobListStyle;
  }

  protected psdelistdataitems: IPSDEListDataItem[];
  getPSDEListDataItems(): IPSDEListDataItem[] | null {
    return (
      this.psdelistdataitems ||
      (this.psdelistdataitems = this.fillChildListModel(
        this.M.getPSDEListDataItems,
        S._291,
      ) as IPSDEListDataItem[])
    );
  }

  findPSDEListDataItem(objKey: any): IPSDEListDataItem | null {
    return this.getPSModel5(
      S._291,
      this.getPSDEListDataItems(),
      objKey,
    ) as IPSDEListDataItem;
  }

  protected psdelistitems: IPSDEListItem[];
  getPSDEListItems(): IPSDEListItem[] | null {
    return (
      this.psdelistitems ||
      (this.psdelistitems = this.fillChildListModel(
        this.M.getPSDEListItems,
        S._d9,
      ) as IPSDEListItem[])
    );
  }

  findPSDEListItem(objKey: any): IPSDEListItem | null {
    return this.getPSModel5(
      S._d9,
      this.getPSDEListItems(),
      objKey,
    ) as IPSDEListItem;
  }

  get pagingSize(): number {
    return this.M.pagingSize;
  }

  hasWFDataItems(): boolean {
    return this.M.hasWFDataItems;
  }

  get enableGroup(): boolean {
    return this.M.enableGroup;
  }

  get enablePagingBar(): boolean {
    return this.M.enablePagingBar != null ? this.M.enablePagingBar : false;
  }

  get enableRowEdit(): boolean {
    return this.M.enableRowEdit;
  }

  get enableRowEditGroup(): boolean {
    return this.M.enableRowEditGroup;
  }

  get enableRowEditOrder(): boolean {
    return this.M.enableRowEditOrder;
  }

  get enableRowNew(): boolean {
    return this.M.enableRowNew;
  }

  get noSort(): boolean {
    return this.M.noSort;
  }

  get showHeader(): boolean {
    return this.M.showHeader;
  }
  get cls(): string {
    return 'PSDEListImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._246 || cls == S._250) return true;
    return super.instanceof(cls);
  }
}
